<%@ page import="cn.edu.zut.model.Book" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.edu.zut.dto.BookAndType" %><%--
  Created by IntelliJ IDEA.
  User: 李林
  Date: 2019/6/19
  Time: 14:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>图书管理界面</title>
    <style>a{text-decoration: none}</style>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/js/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bookmanager.css?v=201906242">
    <script src="/js/jquery.min.js" charset="UTF-8"></script>
    <script src="/js/bootstrap.min.js" charset="UTF-8"></script>
    <script src="/js/bootstrap-table.min.js" charset="UTF-8"></script>
    <style>a{text-decoration:none}</style>
    <script>
        $(document).ready(function(){
            $("#table_page").bootstrapTable({
                columns:[{
                    field:'id',
                    title:'Id'
                },{
                    field:'ISBN',
                    title:'isdn'
                },{
                    field:'BookName',
                    title:'图书名称'
                },{
                    field:'Author',
                    title:'作者'
                },{
                    field:'Type',
                    title:'类别'
                },{
                    field:'Publish',
                    title:'出版社'
                },{
                    field:'UnitPrice',
                    title:'单价'
                },{
                    field:'Status',
                    title:'状态'
                },{
                    field:'Operation',
                    title:'操作'
                },]
            });
        });
    </script>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        body{
            background-color: white;
        }
        h1{
            background-color: aqua;
        }
        .label{
            background-color: #3BD9FF;
        }
        td{
            text-align: center;
        }
        table{

            background-color: white;
        }
    </style>

</head>
<body>
<h1 align="center">图书管理界面</h1>
<div id="box">
    <form action="/bookSearch">
        <select id="select" name="selectName">
            <option value="书名">书名</option>
            <option value="isbn">isbn</option>
            <option value="作者">作者</option>
            <option value="类别">类别</option>
            <option value="出版社">出版社</option>
        </select>
        <input class ="put1" type="text" name="search" placeholder="请输入关键字">
        <input class ="put2" type="submit" value="搜索">
        <%--<div id="search">搜索</div>--%>
    </form>
    <div id="add"><a style="color: #ffffff" href="/bookAddPre">新增图书</a></div>

</div>
<div>
    <table class="table table-striped  table-bordered table-condensed" id="table_page"
           data-pagination="true"
           data-side-pagination="client"
           data-page-size="5">
            <%
        List<BookAndType> books= (List <BookAndType>)session.getAttribute("bookALL");
        for (BookAndType book: books){
            out.println("<tr>");
            out.println("<td>"+book.getBookid()+"</td>");
            out.println("<td>"+book.getIsbn()+"</td>");
            out.println("<td>"+book.getBookname()+"</td>");
            out.println("<td>"+book.getAuthor()+"</td>");
            out.println("<td>"+book.getTypename()+"</td>");
            out.println("<td>"+book.getPublish()+"</td>");
            out.println("<td>"+book.getUnitprice()+"</td>");
//            out.println("<td>"+book.getCount()+"</td>");
            if(book.getStatus()==0)
                out.println("<td>"+"未借阅" +"</td>");
            else
                out.println("<td>"+"<a href='/bookStatusPre/"+book.getBookid()+"'>已借阅</a>" +"</td>");
//            out.println("<td>"+book.getStatus()+"</td>");
            out.println("<td><a href='/bookDelete/"+book.getBookid()+"'>删除</a> | <a href='/bookUpdatePre/"+book.getBookid()+"'>修改</a></td>");
            out.println("</tr>");
        }
    %>
</div>
${result}
</table>
</body>
</html>
